<script>
import { mapState } from 'vuex'
import AOS from "aos"
import { correctPullDown } from '@/utils/global'
import ChangePage from '@/mixins/ChangePage.vue'
// 初始化动画
// 初始化动画
AOS.init();

export default {
  name: 'TeacherLibrary',
  // 混入方法，公共方法previousPage，上滑至上一页
  mixins: [ ChangePage ],
  computed: {
    // 动态计算高度
    cssVar() {
      return {
        'height': document.documentElement.clientHeight + 'px'
      }
    }, ...mapState({
      gender: state => state.info.gender,
      annualData: state => state.annualData
    })
  },
  mounted () {
    // 每个页面都要有
    correctPullDown()
  },
  methods: {
    changePage() {
      this.$router.push({
        path: '/person/teacher/intro'
      })
    }
  }
}
</script>
<template>
  <div v-swipeup="changePage" v-swipedown="previousPage">
    <div :class="gender === '1' ? 'teacher-boy' : 'teacher-girl'" :style="cssVar" @click="changePage">
      <!-- 这里是动画的效果，参考aos官网https://michalsnik.github.io/aos/ -->
      <div class="teacher-con">
        <div :data-aos="'fade-right'"
             data-aos-easing="ease-in-back"
             data-aos-delay="300"
             data-aos-offset="0"
             data-aos-duration="800"
             id="myText">
          <div v-if="annualData.libraryEnterCishu" class="mt-10">
            <div class="mt-10">
              <br/>
              <br/>
              <p>在过去一年里</p>
              <p>您踏入图书馆 <span class="data">{{ annualData.libraryEnterCishu}}</span> 次</p>
              <p>在那宁静的知识殿堂中</p>
              <p>您如一位执着的寻宝者</p>
              <p>在字里行间探寻知识</p>
              <p>努力提高自我</p>
            </div>
          </div>
          <!-- 兜底文案 -->
          <div v-else class="mt-10">
            <div class="mt-10">
              <br/>
              <p>在过去一年里</p>
              <p>您一直在知识的海洋中探寻</p>
              <p>像一位执着的寻宝者</p>
            </div>
            <div class="mt-10">
              <p>通过各种资源</p>
              <p>努力提升自我</p>
              <p>保持求知的热情不减</p>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>

</template>
<style scoped>
.teacher-boy {
  background: url("../../assets/images/library/teacher_boy.jpg") no-repeat;
  background-size: 100% 100%;
}
.teacher-girl {
  background: url("../../assets/images/library/teacher_girl.jpg") no-repeat;
  background-size: 100% 100%;
}
.teacher-con{
  padding: 100px 40px;
}
p {
  color: #1b3b6a;
}
</style>